#!/usr/bin python3
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    l1 = int(input())
    l2 = [int(i) for i in input().split(' ')]

    col = len(l2)
    tmp = []
    for i in l2:
        if i not in tmp:
            tmp.append(i)
    raw = max(l2) + len(tmp)

    if col > raw:
        print(raw)
    else:
        print(col)
